﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MealBooking.Core.Models.Dishes;
using Microsoft.Practices.ServiceLocation;
using MealBooking.Core.Services.Interface;
using MealBooking.Core.Models.Meals;
using MealBooking.Core.Services.Interface.MealService;
using MealBooking.Core.Services.Interface.DishService;

namespace MealBooking.Core
{
    public static partial class CoreService
    {
        public static class MealService
        {
            #region private
            private static IMealService GetInstance()
            {
                return ServiceLocator.Current.GetInstance<IMealService>();
            }
            #endregion

            #region Meal
            public static Meal MealDetail(string mealId)
            {
                return GetInstance().MealDetail(mealId);
            }
            public static List<Meal> MealDetails(List<string> mealIds)
            {
                return GetInstance().MealDetails(mealIds);
            }
            public static MealWithSum OrderNewMeal(Meal newMeal)
            {
                return GetInstance().OrderNewMeal(newMeal);
            }
            #endregion

            #region MealCategory
            public static List<MealCategory> AllMealCategories()
            {
                return GetInstance().AllMealCategories();
            }
            public static List<MealCategory> AllMealCategoriesDishTemplatesNotNull()
            {
                return GetInstance().AllMealCategoriesDishTemplatesNotNull();
            }
            public static MealCategory IsMealCategoryNameInUse(string newMealCategoryName)
            {
                return GetInstance().IsMealCategoryNameInUse(newMealCategoryName);
            }
            public static MealCategory MealCategoryDetail(string mealCategoryId)
            {
                return GetInstance().MealCategoryDetail(mealCategoryId);
            }
            public static MealCategory AddNewMealCategory(MealCategory newMealCategory)
            {
                return GetInstance().AddNewMealCategory(newMealCategory);
            }
            public static MealCategory UpdateMealCategoryInformation(MealCategory newMealCategory)
            {
                return GetInstance().UpdateMealCategory(newMealCategory);
            }
            #endregion

            #region DishCategories in MealCategory
            public static List<DishCategory> DishCategoriesInMealCategory(string mealCategoryId)
            {
                IDishService DishService = ServiceLocator.Current.GetInstance<IDishService>();
                return DishService.DishCategoriesInMealCategory(mealCategoryId);
            }
            public static void AddDishCategoryToMealCategory(string mealCategoryId, DishCategory newDishCategory)
            {
                GetInstance().AddDishCategoryToMealCategory(mealCategoryId, newDishCategory);
            }
            #endregion

            #region Dishes in MealCateogry
            public static Dictionary<DishTemplate, List<Dish>> DishTemplatesInMealCategory(string mealCategoryId)
            {
                return GetInstance().DishTemplatesInMealCategory(mealCategoryId);
            }
            #endregion
        }
    }
}
